//package com.spring.mybatis.anno.config;
//
//import javax.sql.DataSource;
//
//import com.spring.mybatis.anno.dao.UserDao;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
//import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
//
///**
// * com.spring.mybatis.anno.config
// *
// * @author humdeef
// * @since 2019-07-20
// */
//@Configuration
//@MapperScan(basePackageClasses = UserDao.class)
//public class MybatisConfig {
//
//  @Bean
//  public DataSource dataSource() {
//    return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).addScript("db.sql").build();
//  }
//
//  @Bean
//  public DataSourceTransactionManager transactionManager() {
//    return new DataSourceTransactionManager(dataSource());
//  }
//
//  @Bean
//  public SqlSessionFactory sqlSessionFactory() throws Exception {
//    SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
//    sessionFactory.setDataSource(dataSource());
//    return sessionFactory.getObject();
//  }
//}
